# Contributor: Vlad Glagolev <scm@vaygr.net>
# Maintainer: Vlad Glagolev <scm@vaygr.net>
pkgname=newsyslog
pkgver=1.2.0.91
pkgrel=1
pkgdesc="utility that automates system log rotation and compression"
url="https://github.com/robohack/newsyslog"
arch="all"
license="MIT"
makedepends="automake autoconf groff"
subpackages="$pkgname-doc"
source="https://github.com/robohack/newsyslog/archive/refs/tags/v$pkgver/newsyslog-$pkgver.tar.gz
	10-compat.patch
	20-html.patch
	"

prepare() {
	default_prepare
	autoreconf -fisv
}

build() {
	CFLAGS="$CFLAGS -D_GNU_SOURCE" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-syslogd_pid=/run/syslogd.pid \
		--with-gzip
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 newsyslog.conf "$pkgdir"/etc/newsyslog.conf

	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="
7e3522b5fc8332f83c902b0c4f3e1539b2e25a9acea0d48540d2283f7675a324c2cdf008c9fa49b8091f17f7eff55017058aa81eaf263a75b94bf4eada70c5ec  newsyslog-1.2.0.91.tar.gz
bcb598cbe8e48fc81a8503ef3f07131d1c57a8e30b6cd45a0553beaa702e1f998eafcb02751b7f1b2c648b93278d7aecc10da46da4690405344ac882ec70befa  10-compat.patch
4194b6334324e857d8d3d047111a266381af86649b21e5ff44b987a6ef9e39a4a8bcea8f8a1d989aceac84fd7ac88726bd1e22ce6f9e47c2a67958fc290cbafb  20-html.patch
"
